﻿using System;
using System.Collections.Generic;

namespace CoreRay.Testing.MockClasses
{
    //-----------------------------------------------------------------------------------------
    /// <summary>
    /// Mock class for abstract class <see cref="Sampler"/>.
    /// </summary>
    //-----------------------------------------------------------------------------------------

    public class MockSampler : Sampler
    {
        //-----------------------------------------------------------------------------------------
        // Private members.
        //-----------------------------------------------------------------------------------------

        private int counter;


        //-----------------------------------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="MockSampler"/> class.
        /// </summary>
        /// <param name="renderRegion">The render region used for sampling.</param>
        /// <param name="samplesPerPixel">The number of samples per pixel.</param>
        //-----------------------------------------------------------------------------------------

        public MockSampler(RenderRegion renderRegion, int samplesPerPixel) : base(renderRegion, samplesPerPixel)
        {

        }


        //-----------------------------------------------------------------------------------------
        /// <summary>
        /// Returns the next sample. This method must be overrided by samplers.
        /// </summary>
        /// <returns>
        /// The next sample or null if all the samples have been generated.
        /// </returns>
        //-----------------------------------------------------------------------------------------

        protected override Sample GetNextSample()
        {
            if(counter < 5)
            {
                counter++;
                return new Sample(5, 5);
            }

            return null;
        }
    }
}
